#include<stdio.h>
int main(int argc, char const *argv[])
{
    FILE* fp;
    fp=fopen("abc.c","a+");
    if(!fp)
    {
        printf("文件打开失败");
        return ;
    }
    char str[]={"#include <stdio.h> \n int main() \n {printf(\"this is a text\");}"};
    // int i;
    // while(str[i])
    // {
    //     fputc(str[i],fp);
    //     i++;
    // }
    fputs(str,fp);
    rewind(fp);
    char buf[100]={"\0"};
    while (fgets(buf, 100, fp) != NULL)
    {
        printf("%s",buf);
    }
    fclose(fp);
    return 0;
}